package com.aliyun.inventory.server.dao.mapper;

import com.aliyun.inventory.server.dao.entity.InventoryDeductionDetailDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * ItemInventoryDeductionDetail Mapper （商品库存扣减明细映射器）
 *
 * 
 * @date 2024/11/26
 */
@Mapper
public interface InventoryDeductionDetailMapper extends BaseMapper<InventoryDeductionDetailDO> {

    @Select(
        "select sum(deduction_quantity) from tech_solution_inventory_deduction_detail where user_id = #{userId} and product_id = "
            + "#{productId}")
    Integer getTotalDeductionQuantity(@Param("userId") long userId, @Param("productId") long productId);
}